home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -in_the_mag- / reader_requests / xgtool / xgtoolset / source / myheader.h < prev    next >
C/C++ Source or Header  |  2000-02-23  |  3KB  |  94 lines

  1. /*
  2.    myheader.h - Useful #defines and typedefs for tool/accessory programs.
  3. */
  4.  
  5. #ifndef MYHEADER_H
  6. #define MYHEADER_H
  7.  
  8. /* Length of tool/accessory id. */
  9. #define ID_LEN 4
  10.  
  11. /* Make an id out of four characters. */
  12. #define MAKE_ID(a, b, c, d)     ((ULONG) ((((a << 8) + b << 8) + c << 8) + d))
  13.  
  14. /* Make an id out of a string. */
  15. #define MAKE_IDS(s)             (MAKE_ID(s[0], s[1], s[2], s[3]))
  16.  
  17. /* Split an id into four characters. */
  18. #define SPLIT_ID(id, a, b, c, d)        \
  19. do {                                    \
  20.   a = (UBYTE) ((id >> 24) & 0xff);      \
  21.   b = (UBYTE) ((id >> 16) & 0xff);      \
  22.   c = (UBYTE) ((id >> 8) & 0xff);       \
  23.   d = (UBYTE) (id & 0xff);              \
  24. } while (0)
  25.  
  26. /* Split an id into a string. */
  27. #define SPLIT_IDS(id, s)                \
  28. do {                                    \
  29.   SPLIT_ID(id, s[0], s[1], s[2], s[3]); \
  30. } while (0)
  31.  
  32. /* Maximum MIDI note # */
  33. #define MIDI_NOTE_MAX (127)
  34.  
  35. /* Number of MIDI notes. */
  36. #define MIDI_NOTE_NUM (MIDI_NOTE_MAX + 1)
  37.  
  38. /* Maximum program change number. */
  39. #define PC_CHANGE_MAX 127
  40.  
  41. /* Number of program changes. */
  42. #define PC_CHANGE_NUM (PC_CHANGE_MAX + 1)
  43.  
  44. /* Maximum CC value. */
  45. #define CC_VALUE_MAX 127
  46.  
  47. /* Number of CC values. */
  48. #define CC_VALUE_NUM (CC_VALUE_MAX + 1)
  49.   
  50. /* Flags for use in the BRB file requester. */
  51. #define FILES_DELETE    1               /* Delete button */
  52. #define FILES_OPEN      2               /* Open button */
  53. #define FILES_SAVE      4               /* Save button */
  54. #define FILES_TEST      8               /* ??? */
  55. #define FILES_TYPE      16              /* Type string gadget */
  56. #define FILES_PATH      32              /* Path string gadget */
  57.  
  58. /* Initial placement of tool/accessory windows. */
  59. #define INITIAL_LEFT    50
  60. #define INITIAL_TOP     50
  61.  
  62. /* Unprototyping cast. */
  63. typedef long (*no_prototype)();
  64.  
  65. /* Void cast. */
  66. typedef void (*void_prototype)();
  67.  
  68. /* Event *cast. */
  69. typedef struct Event *(*event_prototype)();
  70.  
  71. /* For non-stdio debugging messages. */
  72. #define DEBUG(message)                                          \
  73. do {                                                            \
  74.   struct EasyStruct es = {                                      \
  75.     sizeof(struct EasyStruct),                                  \
  76.     0,                                                          \
  77.     "Debugging information",                                    \
  78.     "Message: %s",                                              \
  79.     "OK"                                                        \
  80.     };                                                          \
  81.   (void) EasyRequest(functions->window, &es, 0, message);       \
  82. } while (0)
  83.  
  84. #define NOTE_LENGTH(x)  (768 >> (x))
  85.  
  86. #define MBC_STRING_LENGTH 12
  87.  
  88. #define CLOCKSPERMEASURE 768L
  89.  
  90. #define STREQ(x, y) (strcmp((x), (y)) == 0)
  91. #define STREQN(x, y, n) (strncmp((x), (y), (n)) == 0)
  92.  
  93. #endif  /* MYHEADER_H */
  94.